export const handleCategoryData = data => {
  const categories = data.categories
  const category = Object.entries(categories).map(([key,value]) => {
    return {
      name: value,
      subs:[]
    }
  })
  const sub = data.sub
  for (let item of sub) {
    category[item.category].subs.push(item)
  }
  return category
}
export const handleLetterList = () => {
  const letterList = [
    {
      name: '热门',
      initial:-1
    }
  ]
  const aCode = 'A'.charCodeAt(0)
  const zCode = 'Z'.charCodeAt(0)
  for (let i = aCode; i <= zCode;i++){
    const object = {
      name: String.fromCharCode(i),
      initial:i
    }
    letterList.push(object)
  }
  letterList.push({
    name: '其他',
    initial:0
  }) 
  return letterList
}